using System.Collections.Generic;
using Freedom.Repository.Models;

namespace Freedom.Repository.Migrations
{
    using System.Data.Entity.Migrations;

    internal sealed class Configuration : DbMigrationsConfiguration<FreedomContext>
    {
        public Configuration()
        {
            AutomaticMigrationsEnabled = false;
        }

        protected override void Seed(FreedomContext context)
        {
            //  This method will be called after migrating to the latest version.

            //  You can use the DbSet<T>.AddOrUpdate() helper extension method 
            //  to avoid creating duplicate seed data. E.g.
            //

            var products = new List<Product>
            {
                new Product { Name = "Tomato Soup", Category = "Groceries", Price = 1 }, 
                new Product { Name = "Yo-yo", Category = "Toys", Price = 3.75M }, 
                new Product { Name = "Hammer", Category = "Hardware", Price = 16.99M }, 
                new Product { Name = "bicycle", Category = "Groceries", Price = 11 }, 
                new Product { Name = "tata", Category = "Toys", Price = 31.75M }, 
                new Product { Name = "lala", Category = "Hardware", Price = 116.99M },
                new Product { Name = "Voyoo", Category = "Groceries", Price = 12 }, 
                new Product { Name = "Merro", Category = "Toys", Price = 32.75M }, 
                new Product { Name = "Ficcel", Category = "Hardware", Price = 216.99M },
                new Product { Name = "ss", Category = "Groceries", Price = 31 }, 
                new Product { Name = "cc", Category = "Toys", Price = 33.75M }, 
                new Product { Name = "dd", Category = "Hardware", Price = 16.939M }   
            };
            products.ForEach(s => context.Products.AddOrUpdate(e => e.Name, s));
            context.SaveChanges();       

        }
    }
}
